﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Mojito.Model
{
    /// <summary>
    ///  业务返回码
    /// </summary>
    public enum ResponseModelCode
    {
        /// <summary>
        ///  未登录, 未授权
        /// </summary>
        UnAuthorize = -1,
        /// <summary>
        ///  成功
        /// </summary>
        Success = 1,
        /// <summary>
        ///  业务型错误:
        ///   账号密码错误
        ///   重复值
        ///   业务要求无法删除的错误
        /// </summary>
        AppError = 100,
        /// <summary>
        ///  请求模型验证失败
        /// </summary>
        ParamError = 101,
        /// <summary>
        ///  系统意外错误, 引起程序崩溃的错误
        ///  对象无法找到
        /// </summary>
        SystemError = 500,
        /// <summary>
        ///  对象无法找到等
        /// </summary>
        NotFound = 501,
        /// <summary>
        ///  数据库操作错误
        /// </summary>
        SqlError = 502,
    }

    /// <summary>
    /// 接口统一返回模型
    /// </summary>
    public class ResponseModel
    {
        /// <summary>
        ///  状态码
        /// </summary>
        public ResponseModelCode Code { get; set; }
        /// <summary>
        ///  消息短语
        /// </summary>
        public string Message { get; set; }
        /// <summary>
        ///  附加数据
        /// </summary>
        public object Data { get; set; }
    }
}
